package com.bjqh.edu.UI.Activity.Index;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.bjqh.edu.Base.AppConstants;
import com.bjqh.edu.Bean.Login;
import com.bjqh.edu.R;
import com.bjqh.edu.UI.Fragment.AlreadyFragemnt;
import com.bjqh.edu.UI.Fragment.CanceledFragment;
import com.bjqh.edu.UI.Fragment.OKCoursesFragment;
import com.bjqh.edu.UI.Fragment.PendingCoursesFragment;
import com.bjqh.edu.UI.Fragment.PendingFragment;
import com.bjqh.edu.adapter.Send3Adapter;
import com.bjqh.edu.adapter.SendAdapter;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.callback.StringCallback;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import okhttp3.Call;
import okhttp3.Response;

public class PrivateClassActivity extends AppCompatActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_qx)
    TextView tvQx;
    @BindView(R.id.rl_top_tilte)
    RelativeLayout rlTopTilte;
    @BindView(R.id.tl_tab)
    TabLayout tlTab;
    @BindView(R.id.vp_content)
    ViewPager vpContent;
    private Send3Adapter adapter;
    private ArrayList<Fragment> datas;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //全屏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_private_class);
        ButterKnife.bind(this);
        tvTitle.setText("我的房间");
        datas = new ArrayList<>();
        datas.add(new PendingCoursesFragment());
        datas.add(new OKCoursesFragment());
        adapter = new Send3Adapter(getSupportFragmentManager(), datas);//初始化fragment类型adapter,datas为adapter构造函数参数
        vpContent.setAdapter(adapter);
        //加入title选择和被选择的颜色,前面为未点击的颜色,后面为点击后的颜色
        tlTab.setTabTextColors(ContextCompat.getColor(this, R.color.black_text), ContextCompat.getColor(this, R.color.pink));
        tlTab.setSelectedTabIndicatorColor(ContextCompat.getColor(this, R.color.pink));
        tlTab.setupWithViewPager(vpContent);//将tablayout与viewpager建立关系
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }
}
